<template>
    <div>
        <li v-for="p in list">{{ p.name }}--{{ p.age }}</li>
        <img :src="dog" alt="狗狗" v-for="(dog, index) in dogList" :key="index">
        <button @click="addDog">点击添加一张狗狗</button>
        <h2>当前的求和为：{{ sum }}</h2>
        <button @click="addSum">点击加一</button>
    </div>
</template>
<script setup lang="ts">
// 接收父组件传递参数
import useDog from '@/hooks/addDog'
import useSum from '@/hooks/addSum'
import { defineProps, } from 'vue';
defineProps(['list'])
// 解构赋值
const {dogList,addDog}=useDog();
const {sum,addSum}=useSum();
</script>
<style lang="css" scoped>
img {
    height: 250px;
    margin-right: 20px;
}
</style>